<script type="text/javascript">
	$(function() {
		//提交留言表单
		$("#commentPostForm").submit(function() {
			var data = $(this).serialize();
			jQuery.post("/Wyn/profile_tab/leave_mesage", data,function(){
				//留言发表成功后刷新好友留言tab
				var $comment = $("#comment");
				//因为新增了留言，重现填充$("#comment")的内容
				jQuery.post("/Wyn/profile_tab/go_message",
							function(data){
								$comment.html(data).attr("isReady","true").show();;
							});
				$("#friendsGossipList").click();
			});
			return false;
		});
		//点击新鲜事链接
		$("#freshThingsA").click(function(){
			//改变新鲜事和留言链接的选中状态
			$(this).parent().addClass("c").addClass("selected");
			$("#friendsGossipList").parent().removeClass("c").removeClass("selected");
			//隐藏留言tab
			$("#comment").hide();
			
			if("true" == $("#miniFeed").attr("isReady")){
				$("#miniFeed").show();//已经加载过数据直接显示
			}else{
				//加载新鲜事
				jQuery.post("/Wyn/profile_tab/go_fresh_things",
					function(data){
						//第一次加载数据后isReady置为"true"
						$("#miniFeed").html(data).attr("isReady","true").show();;
					});
			}
		});	
		//点击留言链接
		$("#friendsGossipList").click(function(){
			//改变新鲜事和留言链接的选中状态
			$(this).parent().addClass("c").addClass("selected");
			$("#freshThingsA").parent().removeClass("c").removeClass("selected");
			$("#miniFeed").hide();//隐藏新鲜事tab
			var $comment = $("#comment");
			if("true" == $comment.attr("isReady")){
				$comment.show();
			}else{
				//加载留言
				jQuery.post("/Wyn/profile_tab/go_message",
							function(data){
								//第一次加载数据后isReady置为"true"
								$comment.html(data).attr("isReady","true").show();;
							});
			}
		});	
		//默认是查看新鲜事
		$("#freshThingsA").click();
	});
</script>
<div class="col-center">
	<div class="main-content">
		<div id="comWall" class="com-wall">
			<div id="comfirm_diag"
				class="generic_dialog wallpro_dialog pop_dialog" style=""></div>
			<div class="box-holder talk-box">

				<div class="box" id="gossipBoard" stats="n2_gossipboard">
					<h4 class="box-header">
						<span><a href="javascript:;" class="title"
							stats="n2_gossipboard">留言板</a> <a
							href="http://gossip.renren.com/getgossiplist.do?id=278271144&amp;age=recent"
							class="count"></a> </span> <small> <a stats="pf_allgossip"
							href="http://gossip.renren.com/getgossiplist.do?id=278271144&amp;age=recent">所有留言</a>
						</small>
					</h4>
					<div class="box-body">
						<div class="m-editor" id="miniEditor">
							<form id="commentPostForm">
								<div class="m-editor-textarea">
									<textarea id="cmtbody" tabindex="2" name="messageBody" rows="4"
										cols="60" style="color: rgb(136, 136, 136);"></textarea>

								</div>

								<div class="m-editor-submit">
									<input stats="pf_subgossip" type="submit" id="commentPostBtn"
										value="&nbsp;留言&nbsp;" class="input-button">
									<#--自己的页面所以被留言者也是自己-->
									<input type="hidden" value="${Session.user.userName}" name="otherUserName"> 
								</div>
							</form>
						</div>

					</div>
				</div>
				<div class="nav-tabs">
					<ul class="tabs clearfix">
						<li>
							<a id="freshThingsA" stats="pf_freshsfeed" href="#nogo">新鲜事</a>
						</li>
						<li>
							<a id="friendsGossipList" stats="pf_gossip" href="#nogo">好友留言</a>
						</li>
					</ul>
				</div>
				<div id="miniFeed">
				</div>
				<div id="comment" class="comment-holder" style="display: none;">
				</div>
			</div>
		</div>
	</div>
</div>
<div class="col-right">
	<#include "portrait.ftl">
	<div class="extra-side">
		<div id="visitors" class="mod">
			<div class="mod-header">
				<div class="mod-header-in">
					<a stats="pf_myfoot" href="#nogo" class="more">管理</a>
					<h4>最近来访</h4>
				</div>
			</div>
			<div class="mod-body-out">
				<div class="mod-body">
					<ul class="people-list">
						<#list recentVisitors as visitor>
							<li>
								<a stats="pf_recent" class="avatar" target="_blank" href="/Wyn/profile/goOtherProfile?otherUserName=${visitor[0]}" title="查看${visitor[1]}的个人主页">
								 	<img stats="pf_recent" src="/Wyn/album/loadImage?fileId=${visitor[2]}" width="50">
								</a>
								<div class="people-detail">
									<center>
										<a stats="pf_recent" namecard="147409206" title="${visitor[1]}"
											href="/Wyn/profile/goOtherProfile?otherUserName=${visitor[0]}">${visitor[1]}</a>
									</center>
								</div>
							</li>
						</#list>
					</ul>
				</div>
			</div>
		</div>

	</div>
</div>
<div id="flash-content"></div>
